package com.tvunetworks.center.user.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.tvunetworks.center.common.model.UserDeviceRecord;
import com.tvunetworks.center.user.mapper.UserDeviceRecordMapper;
import com.tvunetworks.center.user.service.UserDeviceRecordService;
import com.tvunetworks.center.user.util.DistributedGlobalIdUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * @program: tvucc-aggregator
 * @description: UserDeleteRecordServiceImpl
 * @author lebronchen
 * @create: 2021-02-23 14:27
 **/
@Slf4j
@Service
public class UserDeviceRecordServiceImpl implements UserDeviceRecordService {
    @Autowired
    private UserDeviceRecordMapper userDeviceRecordMapper;
    @Autowired
    private DistributedGlobalIdUtil distributedGlobalIdUtil;

    @Override
    public void saveRecord(UserDeviceRecord userDeviceRecord) {
        try {
            userDeviceRecord.setId(distributedGlobalIdUtil.netxId()+"");
            userDeviceRecord.setDeleteFlag(0);
            userDeviceRecord.setCreateTime(System.currentTimeMillis()+"");
            userDeviceRecordMapper.insert(userDeviceRecord);
        } catch (Exception e) {
            log.error("saveRecord Exceptipn param", JSONObject.toJSONString(userDeviceRecord));
            log.error("saveRecord Exceptipn:[{}]",e);
        }

    }
}
